package com.vivek.guess.what.calculator;

import java.util.List;

import com.vivz.guess.what.type.Position;
import com.vivz.guess.what.vo.Clue;
import com.vivz.guess.what.vo.Guess;
import com.vivz.guess.what.vo.ProbabilityMatrix;

public class AllXCalculator extends AbstractCalculator {

	@Override
	public void calculate(final List<Guess> guesses, final ProbabilityMatrix pMatrix) {

		for (final Guess guessX : guesses) {
			final Clue clueX = guessX.getClue();
			if (!clueX.hasDots() && clueX.hasCrosses()) {
				final String word = guessX.getWord();
				for (final Character c : word.toCharArray()) {
					final Position p = Position.getInstance(1 + word.indexOf(c));
					pMatrix.markOnlyPossiblePosition(c, p);
				}
			}
		}
	}

}
